<!--
  ~ Copyright 2021 Red Hat, Inc. and/or its affiliates.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <title>Query Answer Service Application</title>
    <link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.min.css"/>
</head>
<body>
<div class="container-fluid">
    <div class="sticky-top d-flex justify-content-center align-items-center" aria-live="polite" aria-atomic="true">
        <div id="notificationPanel" style="position: absolute; top: .5rem;"></div>
    </div>
    <h1>Query and Answer Service Application</h1>
    <p>Use the 'Create new query' button to start a new serverless workflow instance that will manage the query resolution.</p>

    <div style="margin-bottom: .5rem">
        <button id="refreshButton" type="button" class="btn btn-success">
            <span class="fas fa-sync"></span> Refresh
        </button>
        <button id="createQueryButton" type="button" class="btn btn-primary">
            <span class="fas fa-play"></span> Create new query
        </button>
    </div>

    <table class="table table-borderless table-striped" id="queriesTable">
        <!-- Filled in by app.js -->
    </table>
</div>


<div class="modal fade" id="createQueryForm" tabindex="-1" aria-labelledby="createQueryFormLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="createQueryFormLabel">Create a new query</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <form>
                    <div class="form-group">
                        <label for="query" class="col-form-label">Query:</label>
                        <textarea class="form-control" id="query"></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" onclick="createQuery()">Create query</button>
            </div>
        </div>
    </div>
</div>

<script src="/webjars/jquery/jquery.min.js"></script>
<script src="/webjars/bootstrap/js/bootstrap.min.js"></script>
<script src="/app.js"></script>

</body>
</html>
